package com.ruoyi.business.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.business.domain.SysUserLoginDriver;
import com.ruoyi.business.domain.vo.SysUserLoginDriverVo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.mapper.BaseMapperPlus;

/**
 * 司机信息Mapper接口
 *
 * @author ruoyi
 * @date 2024-04-20
 */
public interface SysUserLoginDriverMapper extends BaseMapperPlus<SysUserLoginDriverMapper, SysUserLoginDriver, SysUserLoginDriverVo> {


    /**
     * 根据司机名称查询
     *
     * @param driverName
     * @return
     */
    default SysUserLoginDriver selectByName(String driverName) {
        return selectOne(new QueryWrapper<SysUserLoginDriver>()
            .lambda()
            .eq(SysUserLoginDriver::getRealName, driverName)
            .last("limit 1"));
    }

    /**
     * 根据手机号查询
     *
     * @param phone
     * @return
     */
    SysUserLoginDriver selectByPhone(String phone);

    /**
     * 通过手机号查询对应用户
     * @param phonenumber
     * @return
     */
    SysUser selectUserByPhone(String phonenumber);
}
